package com.yunkss.eftool.crypto.key;

/**
 * @author csx
 * @date 2022/2/18 8:28
 * @desc
 */

public class UnCompresseSM2KeyPair {
    private String publicHexX;
    private String publicHexY;
    private String privateHex;
    private String publicHex;

    public UnCompresseSM2KeyPair() {
    }

    public String getPublicHexX() {
        return this.publicHexX;
    }

    public void setPublicHexX(String publicHexX) {
        this.publicHexX = publicHexX;
    }

    public String getPublicHexY() {
        return this.publicHexY;
    }

    public void setPublicHexY(String publicHexY) {
        this.publicHexY = publicHexY;
    }

    public String getPublicHex() {
        String marker = "04";
        if (!this.publicHex.startsWith(marker)) {
            this.publicHex = this.publicHex + marker;
        }

        String tmp = marker + this.publicHexX + this.publicHexY;
        if (!tmp.equalsIgnoreCase(this.publicHex)) {
            throw new IllegalStateException();
        } else {
            return this.publicHex;
        }
    }

    public void setPublicHex(String publicHex) {
        this.publicHex = publicHex;
    }

    public String getPrivateHex() {
        return this.privateHex;
    }

    public void setPrivateHex(String privateHex) {
        this.privateHex = privateHex;
    }

    public String toString() {
        return "UnCompresseSM2KeyPair{publicHexX='" + this.publicHexX + '\'' + ", publicHexY='" + this.publicHexY + '\'' + ", privateHex='" + this.privateHex + '\'' + '}';
    }
}
